<template>
  <div class="my-tab-bar">
    <!-- current 高亮 -->
    <div
      class="tab-item"
      :class="{ current: value === item.id }"
      v-for="item in Footerlist"
      :key="item.id"
      @click="Current(item.id)"
    >
      <span :class="item.icon"></span>
      <span>{{ item.title }}</span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    Footerlist: {
      type: Array,
      required: true,
      validator(value) {
        if (value.length >= 2 && value.length <= 5) {
          return true
        } else {
          return false
        }
      },
    },
    value: {
      type: Number,
      default: 1,
    },
  },
  methods: {
    Current(id) {
      this.$emit('input', id)
    },
  },
}
</script>

<style lang="less" scoped>
.my-tab-bar {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 50px;
  border-top: 1px solid #ccc;
  display: flex;
  justify-content: space-around;
  align-items: center;
  .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    .iconfont {
      font-size: 18px;
    }
  }
  .current {
    color: #1d7bff;
  }
}
</style>
